<?php
/*
	监听电商客首次购物事件

*/
defined('BY_JYA') or exit('error');
$mid=$event['order']['mid'];
$time=$event['order']['paytime'];
$orders=pdo_getall('jy_weishop_order',array('uniacid'=>$_SESSION['uniacid'],'mid'=>$mid,'status'=>'1','ispay'=>'1'));
if($orders){
	$tasks=pdo_getall('jy_inclock_task_record',array('uniacid'=>$_SESSION['uniacid'],'mid'=>$mid,'tasktype'=>'order_first','stoptime >'=>time(),'finishtime >'=>'0'));
	if($tasks){
		//修改任务状态为完成
		foreach($tasks as $task){
			
			pdo_update('jy_inclock_task_record',array('finishtime'=>$time),array('id'=>$task['id']));
			
		}
	}
	
}